package com.dzx.design.behavioral.iterator;

import java.util.List;

/**
 * @author dzx
 * @ClassName:
 * @Description:
 * @date 2019年08月09日 14:21:39
 */
public class CourseIteratorImpl implements  CourseIterator {

    private List list;
    private int pos = 0;
    private Course course;
    public CourseIteratorImpl(List list) {
        this.list = list;
    }

    @Override
    public Course nextCourse() {
        course = (Course)list.get(pos);
        pos++;
        return course;
    }

    @Override
    public boolean isLastCourse() {
        return pos > list.size()-1?true:false;
    }
}
